package com.edu.controller;

import com.edu.mapper.BStudentMapper;
import com.edu.pojo.Student;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @作者 five-five
 * @创建时间 2021/1/19
 */
@RestController
@Api(tags = "客户端学生接口")
public class StudentController {

    @Autowired
    private BStudentMapper studentMapper;

    @Qualifier("discoveryClient")
    @Autowired
    private DiscoveryClient discoveryClient;


    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public List<Student> list(){
        return studentMapper.selectByExample(null);
    }

    @RequestMapping(value = "/discovery", method = RequestMethod.GET)
    public Object discoveryClient(){
        return discoveryClient.getInstances("eureka-customer");
    }

}
